local skel = fk.CreateSkill{
    name = "kt_st__jiwu",
    tags={Skill.Compulsory}
}

Fk:loadTranslationTable{
  ["kt_st__jiwu"] = "极武",
  [":kt_st__jiwu"] = "锁定技，每轮结束时，与你阵营不同的随机一名角色亮明身份并进行一个回合，"..
  "此回合内其使用牌后，你视为对其使用三张【杀】。<br>若均明亮，则从先到后依次杀死这些角色。",

  ["@@kt_st__jiwu"] = "极武",

  ["$kt_st__jiwu1"] = "我的凤翅镏金镋，不杀无名无辈之人。",
  ["$kt_st__jiwu2"] = "你们这些人，也敢号称天下群雄反我大隋？",
  ["$kt_st__jiwu3"] = "招式虚浮，错漏频出。",
  ["$kt_st__jiwu4"] = "我杀你等，如同儿戏。",
  ["$kt_st__jiwu5"] = "你是天下第几？",
  ["$kt_st__jiwu6"] = "兼资文武，威震海内。",
}

skel:addEffect(fk.CardUseFinished,{
  mute = true,
  can_trigger = function (self, event, target, player, data)
    return target:getMark("@@kt_st__jiwu") == 1 and player:hasSkill(skel.name) and player:canUseTo(Fk:cloneCard("slash"), target, {bypass_distances = true, bypass_times = true})
  end,
  on_use = function (self, event, target, player, data)
    player.room:notifySkillInvoked(player, skel.name)
    player:broadcastSkillInvoke(skel.name,math.random(3,4))
    for i =1,3 do
      if player.dead or target.dead then return end
      local usecard = Fk:cloneCard("slash")
      usecard.skillName = skel.name
      if player:canUseTo(usecard, target, {bypass_distances = true, bypass_times = true}) then
        player.room:useCard({
          from = player,
          card = usecard,
          tos = {target}
        })
      end
    end
  end,
})


skel:addEffect(fk.TurnEnd, {
  mute = true,
  can_refresh = function (self, event, target, player, data)
    return target:getMark("@@kt_st__jiwu") == 1
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(target,"@@kt_st__jiwu",2)
  end
})

skel:addEffect(fk.RoundEnd, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local list = {}
    for _,p in ipairs(room:getAlivePlayers()) do
      if not GameMode:friendEnemyJudge(player, p) and p:getMark("@@kt_st__jiwu") == 0 then
        if not p.role_shown then
          table.insertIfNeed(list,p)
        end
      end
    end
    if #list == 0 then
      --杀人
      player.room:notifySkillInvoked(player, skel.name)
      player:broadcastSkillInvoke(skel.name,math.random(5,6))
      list = player:getMark("kt_st__jiwu_skill")
      if #list == 0 then return end
      for _,p in ipairs(list) do
        local c = room:getPlayerById(p)
        if c and not c.dead then
          room:killPlayer{
            who = c,
            killer = player,
          }
        end
      end
      return
    end
    --执行
    player.room:notifySkillInvoked(player, skel.name)
    player:broadcastSkillInvoke(skel.name,math.random(1,2))
    local to = list[math.random(#list)]
    room:setPlayerProperty(to, "role_shown", true)
    room:broadcastProperty(to, "role")
    room:setPlayerMark(to,"@@kt_st__jiwu",1)
    room:addTableMark(player,"kt_st__jiwu_skill",to.id)
    to:gainAnExtraTurn(false,skel.name)
  end,
})

return skel